package com.atguigu.newmvc2.config;

import com.atguigu.newmvc2.interceptor.HanderInteceptor1;
import com.atguigu.newmvc2.interceptor.HanderInteceptor2;
import com.atguigu.newmvc2.interceptor.HanderInteceptor3;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Component
public class WebMvcConfig implements WebMvcConfigurer {
    @Autowired
    private HanderInteceptor1 handerInteceptor1;
    @Autowired
    private HanderInteceptor2 handerInteceptor2;
    @Autowired
    private HanderInteceptor3 handerInteceptor3;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(handerInteceptor1).addPathPatterns("/**");
        registry.addInterceptor(handerInteceptor2).addPathPatterns("/**");
        registry.addInterceptor(handerInteceptor3).addPathPatterns("/**");
    }
}
